package com.example.springlearn.bean;

import java.util.Objects;

public class UserInfo {
    private Integer uid;
    private String username;
    private String password;

    public UserInfo() {
    }

    public UserInfo(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public UserInfo(Integer uid, String password) {
        this.uid = uid;
        this.password = password;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "UserInfo{" +
                "uid=" + uid +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        UserInfo info = (UserInfo) o;
        return (uid.equals(info.getUid()) || username.equals(info.getUsername())) && password.equals(info.getPassword());
    }

    @Override
    public int hashCode() {
        return Objects.hash(uid, username, password);
    }
}
